by a fluke

Translations
по счастливой случайности
He got the job by a fluke.
Он получил работу по счастливой случайности.
Definitions
By a fluke refers to an occurrence that happens by chance or accident, often in a surprising or unexpected way.